

clear

use "$data/survey1_clean.dta", clear



loc experiments "z_worry_corona_econ z_worry_perecon"
		   
			   
preserve 

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""

global output_coeff ""
global output_se ""
global output_name""

foreach choice in `experiments' {

/* Statistics */

	
 xi:  reg `choice' highmort , vce(r)
 	global `choice'_coeff =_b[highmort]
	global `choice'_se =_se[highmort]
	global output_name "$output_name a`choice' "
	global output_coeff "$output_coeff $`choice'_coeff "
	global output_se "$output_se $`choice'_se "
 
 
    sigstar highmort, prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
	
		


 xi:  reg `choice'_update  contagiontreatment `choice', vce(r)
 
  	global `choice'_coeff =_b[contagiontreatment]
	global `choice'_se =_se[contagiontreatment]
	global output_name "$output_name b`choice' "
	global output_coeff "$output_coeff $`choice'_coeff "
	global output_se "$output_se $`choice'_se "
 
 
    sigstar contagiontreatment, prec(3)
    estadd loc thisstat8 = "`r(bstar)'": col`colnum'
    estadd loc thisstat9 = "`r(sestar)'": col`colnum'



	qui sum `choice'_update  
	estadd loc thisstat11 =  r(N): col`colnum'
	
    loc ++colnum
    loc colnames "`colnames' `"`: var la `choice''"'"

	


	} 
	


clear 

di $output_coeff

set obs 4
gen name_var = " "
gen coeff =" "
local l =1
foreach x in $output_name {
replace name_var = "`x'" in `l'
local ++l
}

local l =1
foreach x in $output_coeff {
replace coeff = "`x'" in `l'
local ++l
}

gen se =""
local l =1
foreach x in $output_se {
replace se = "`x'" in `l'
local ++l
}
destring se coeff, replace

gen uci = coeff+1.96*se
gen lci =coeff-1.96*se

sort name_var, stable


export delimited using "$tables/tables_raw/table1_raw.csv", replace






